{liet ke tat ca cac cach ghi N thang tong cac so nguyen duong}
program tongsonguyen;
uses crt;
const
fi='tongsonguyen.inp';
fo='tongsonguyen.out';
var
	f,g:text;
    a:array[0..10001] of integer;
    n:integer;
procedure nhap;
	begin
    	assign(f,fi);
        reset(f);
        	read(f,n);
        close(f);
    end;

procedure xuat(x:integer);
var i:integer;
	begin
    	writeln;
    	for i:=1 to x do
        	write(a[i]:3);
        writeln;
    end;

procedure phantich(x:integer);
var	i:integer;
	begin
		if (a[x] - a[x-1])<2 then
            begin
                a[x-1]:=a[x-1]+a[x];
                xuat(x-1);
                exit;
            end
        else
        	begin
                i:=x-1;
            	while i>=1 do
                	if a[i+1]-a[i]>=2 then
                    	begin
                        	dec(a[i+1]);
                            inc(a[i]);
                            xuat(x);
                        end
                    else
                    	begin
                            if i=1 then
                        		a[x-1]:=a[x-1]+a[x];	
                    		dec(i);
                        end;
            end;	
    end;

procedure xuly;
var	i:integer;
	begin
    	for i:=1 to n do
        	a[i]:=1;
        xuat(n);
        for i:=n downto 1 do
        	phantich(i);
        xuat(1);
    end;
begin
clrscr;
	nhap;
    xuly;
end.
